package leetcode.editor.day;

// 1598. 文件夹操作日志搜集器
// https://leetcode.cn/problems/crawler-log-folder
class CrawlerLogFolder {
    public static void main(String[] args) {
        Solution solution = new CrawlerLogFolder().new Solution();
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        // 模拟（栈的思想）
        public int minOperations(String[] logs) {
            int ans = 0;
            for (String log : logs) {
                if (log.equals("../")) {
                    if (ans != 0) ans--;
                } else if (log.equals("./")) continue;
                else ans++;
            }

            return ans;
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}
